package com.amigo.online.provider.video.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

import com.amigo.online.common.core.mybatis.MyMapper;
import com.amigo.online.common.param.dto.video.VideoQueryDto;
import com.amigo.online.common.param.result.VideoWhoSawMeInfo;
import com.amigo.online.provider.video.model.entity.VideoLook;


@Mapper
@Component
public interface VideoLookMapper extends MyMapper<VideoLook> {

    VideoLook findByVideoIdAndUserid(@Param("videoId") Long videoId, @Param("userId") Long userId);

    List<VideoLook> findByUserid(VideoQueryDto dto);

    List<VideoWhoSawMeInfo> queryWhoSawMe(VideoQueryDto dto);

    int insertIfNotExited(VideoLook vl);

    int insertIfNotExitedNotLogin(VideoLook videoLook);

    @Insert("insert into video_look_record_tbl(user_id,video_id,created_time) values(#{userId},#{videoId},CURRENT_TIMESTAMP())")
    int insertLookRecord(@Param("videoId") Long videoId, @Param("userId") Long userId);

}
